package com.helen.adapter;

import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.helen.entity.RecoveryClassEntity;
import com.helen.shopping.R;
import com.helen.utils.MyLog;

import java.util.ArrayList;
import java.util.List;


/**
 * Created by yang on 2017/11/23.
 */

public class ElectronicClassLeftAdapter extends BaseQuickAdapter<RecoveryClassEntity, BaseViewHolder> {
    private int selectedPostion = 0;

    public ElectronicClassLeftAdapter(int layoutResId, List<RecoveryClassEntity> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(final BaseViewHolder helper, final RecoveryClassEntity item) {
        try {
            final TextView cbItem = (TextView) helper.getView(R.id.cb_item);
            cbItem.setText(item.getName());
//            单选
            if (selectedPostion == helper.getAdapterPosition()) {
                cbItem.setEnabled(true);
            } else {
                cbItem.setEnabled(false);
            }



        } catch (Exception e) {
            MyLog.e("yang", "回收分类异常" + e.toString());
        }
    }

    public int getSelectedPostion() {
        return selectedPostion;
    }

    public void setSelectedPostion(int selectedPostion) {
        this.selectedPostion = selectedPostion;
    }


}
